package com.kgcx.dbutils.utils;


import com.kgcx.dbutils.provider.SelectActiveProvider;
import org.apache.ibatis.annotations.SelectProvider;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface CommonMapper<T> extends Mapper<T> {

    /**
     * 查询所有数据，自动添加条件status=101
     *
     * @return
     */
    @SelectProvider(type = SelectActiveProvider.class, method = "dynamicSQL")
    List<T> selectAllActive();

    /**
     * 查询所有数据，自动添加条件status=101
     *
     * @return
     */
    @SelectProvider(type = SelectActiveProvider.class, method = "dynamicSQL")
    List<T> selectActive(T record);

    /**
     * 查询单条数据，自动添加条件status=101
     *
     * @return
     */
    @SelectProvider(type = SelectActiveProvider.class, method = "dynamicSQL")
    T selectOneActive(T record);

    /**
     * 查询单条，自动添加条件status=101
     *
     * @return
     */
    @SelectProvider(type = SelectActiveProvider.class, method = "dynamicSQL")
    T selectByPrimaryKeyActive(Object key);

    /**
     * 查询数量，自动添加条件status=101
     *
     * @return
     */
    @SelectProvider(type = SelectActiveProvider.class, method = "dynamicSQL")
    int selectCountActive(T record);

    /**
     * 查询存在，自动添加条件status=101
     *
     * @return
     */
    @SelectProvider(type = SelectActiveProvider.class, method = "dynamicSQL")
    boolean existsWithPrimaryKeyActive(Object key);

}
